package com.garden.jobs;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author Garden
 * @date: 2022/4/24 18:14
 */
@Component
public class DemoJob implements SimpleJob {

    private final Logger logger = LoggerFactory.getLogger(DemoJob.class);

    @Override
    public void execute(ShardingContext shardingContext) {
        logger.info("[DemoJob] 调度任务开始...");
        try {
            logger.info("[DemoJob] 调度任务：正在执行调度任务...");
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            logger.error("[DemoJob] 调度出现异常... 信息：{}", e.toString());
        }
        logger.info("[DemoJob] 调度任务结束...");
    }

}
